package pers.mobian.springfirst.firstTest;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;
import pers.mobian.springfirst.sameBeanName.Cat;

import javax.annotation.PreDestroy;

@Component
public class User implements DisposableBean {



//	@Value("mobian")
	private String name ;

//	@Value("22")
	private int age;

	public User() {
		System.out.println(0);

	}

	public User(String name, int age) {
		System.out.println(2);

		this.name = name;
		this.age = age;
	}
	public User(String name) {
		System.out.println(1);
		this.name = name;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}


	@PreDestroy
	public void a(){
		System.out.println("销毁");
	}

	@Override
	public void destroy() throws Exception {
		System.out.println("销毁2");
	}
}
